import { combineReducers, createStore } from 'redux'
import { todoReducer } from './todo'

// 根reducer
const rootReducer = combineReducers({
  todoReducer: todoReducer
})

//导出store类型
export type AppState = ReturnType<typeof rootReducer>

const configureStore = () => {
  //组合中间件
  // const middlewares = [thunkMiddleware]
  // const middleWareEnhancer = applyMiddleware(...middlewares)

  //创建store
  const store = createStore(rootReducer)
  return store
}

export default configureStore

export * from './todo'
